$(function() {
	$('.rightBottom').click(function(){
		$.fn.fullpage.moveSectionDown();
		console.log(123);
	});
	// 大手跟随鼠标移动  
	$(document).mousemove(function(event) {
		var x = event.pageX - $(".hand-08").width() / 2;  // 获得鼠标在页面中的x坐标
		var y = ($(window).height()-event.pageY-10)-449;  // 获得鼠标在页面中的y坐标
		y = y>0?0:y;
   		$(".hand-08").css({"left": x,'bottom':y});
	});
	$('#fullpage .section .p8_content .startShop').mouseover(function(){
		$(this).css('backgroundImage','url(images/btn-08-a.gif)');
	});
	$('#fullpage .section .p8_content .startShop').mouseout(function(){
		$(this).css('backgroundImage','url(images/btn-08.png)');
	});
	$('#fullpage .section .p8_content img:nth-child(2)').click(function(){
		window.location.reload();
	});
	$('#fullpage .section').not(':first').prepend('<img src="images/t1ldiffkjfxxxzhxzd-101-101.png" class="rightTop"/><img src="images/next.png" class="rightBottom"/>');
	$('#fullpage .section:last').find('.rightBottom').remove();
	$.fn.fullpage({
		navigation: true,
		slidesColor: ['#F9DD67', '#84A2D4', '#EF674D', '#FFEEDD','#000','#85D9ED','#000','#000'],
		navigationTooltips:['第一屏','第二屏','第三屏','第四屏','第五屏','第六屏','第七屏','第八屏'],
		menu:'#menu',
		scrollingSpeed:1000,
		afterLoad: function(anchorLink, index) {
			if(index == 2){
				$('#fullpage .section .p2_content .search').show().animate({'left':'19.9%'},'slow',function(){
					$(this).find('img').fadeIn(2000);
					$(this).hide();
					$('#fullpage .section .p2_content .search+img').show().animate({'height':'30px','left':'39%','top':'3%'},'slow',function(){
						$('#fullpage .section .p2_content .search+img+img').show(1000);
						$('#fullpage .section .p2_content_top').html('<img src="images/words-02.png"/>');
					});
				});
			}else if(index == 3){
				$('#fullpage .section .p3_content .imgs img').animate({'opacity':'1'},2000);
			}else if(index == 5){
				$('#fullpage .section .hand-05').animate({'bottom':'0'},'slow',function(){
					$('#fullpage .section .mouse').css('background-image','url(images/mouse-05-a.png)');
					$('#fullpage .section .sofa-05').show().animate({'bottom':'70px'},'slow',function(){
						$(this).hide();
						$('#fullpage .section .p5_content+img').show();
					});
				});
				$('#fullpage .section .p5_content>img:nth-child(2)').animate({'bottom':'218px'},'slow',function(){
					$('#fullpage .section .wenzi').animate({'transform':'rotateX(180deg)'},'slow');
				});
			}else if(index == 6){
				$('#fullpage .section .box').show().animate({'left':'620px'},'slow',function(){
					$(this).animate({'bottom':'35px'},'slow',function(){
						$(this).hide();
						$('#fullpage .section:nth-child(6)').animate({'backgroundPositionX':'100%'},4000,function(){
							$('#fullpage .section .p6_content .courier').animate({'height':'305px'},'slow');
							$('#fullpage .section .p6_content .courier').animate({'right':'506px'},'slow',function(){
								$('#fullpage .section .p6_content img:nth-child(3)').animate({'opacity':'1'},'slow',function(){
									$('#fullpage .section .p6_content .door').show();
									$('#fullpage .section .p6_content .woman').animate({'height':'294px'},'slow');
								});
							});
						});
					});
				});
				$('#fullpage .section .p6_content img:nth-child(4)').animate({'opacity':'1'});
				$('#fullpage .section .p6_content img:nth-child(5)').animate({'opacity':'1'});
			}else if(index == 7){
				$('#fullpage .section #cover').show(function(){$('#fullpage .section .star').show()}).animate({'width':'0'},1000,function(){
					$('#fullpage .section #cover+img').animate({'opacity':'1'},'fast')
				});
			}else{
				
			}
		},
		onLeave:function(index,direction){
			if(index == 2 && direction == 'down'){
				$('#fullpage .section .p2_content .white').show();
				$('#fullpage .section #sofe').show();
				$('#fullpage .section #sofe').animate({'bottom':'-530px','left':'560px','width':'207px'},2000);
			}
			if(index == 3 && direction == 'down'){
				$('#fullpage .section #sofe').hide();
				$('#fullpage .section #drop_sofa').show();
				$('#fullpage .section #drop_sofa').animate({'bottom':'-527px','left':'600px'},2000,function(){
					$(this).hide();
					$('#fullpage .section .p4_content .car').css('backgroundImage','url(images/t1f.png)');
					$('#fullpage .section .p4_content .car').animate({'left':[1600,'easeInOutElastic']},1500,function(){
						$('#fullpage .section .p4_content>img').attr('src','images/words-04-a.png');
						$('#fullpage .section .p4_content .receipt').fadeIn(1000);
					});
				});
			}
			if(index == 5 && direction == 'down'){
				$('#fullpage .section .p5_content+img').animate({'bottom':'-160px','left':'700px','height':'30'},1900,function(){
					$(this).hide();
				});/*沙发入盒*/
			}
		}
	});
});